package com.fengwk.user.face.client;

import java.util.Collection;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.fengwk.user.face.client.hystrix.ValidationClientHystrix;
import com.fengwk.user.face.constant.UserServerConstant;

@FeignClient(
		name = UserServerConstant.FEIGN_CLIENT_NAME, 
		path = "/api/validation",
		fallback = ValidationClientHystrix.class)
public interface ValidationClient {
	
	/**
	 * 角色列表校验
	 * 
	 * @param userId 用户id
	 * @param roles 角色列表
	 * @return 全部校验成功返回true,否则返回false
	 */
	@PostMapping("/validationRoles")
	boolean validationRoles(
			@RequestParam(value = "userId", required = true) Long userId, 
			@RequestParam(value = "roles", required = true) Collection<String> roles);
	
	/**
	 * 权限列表校验
	 * 
	 * @param userId 用户id
	 * @param permissions 权限列表
	 * @return 全部校验成功返回true,否则返回false
	 */
	@PostMapping("/validationPermissions")
	boolean validationPermissions(
			@RequestParam(value = "userId", required = true) Long userId, 
			@RequestParam(value = "permissions", required = true) Collection<String> permissions);
	
}
